import os

event_dics = [
    'Charlie',
    'Ferguson',
    'German',
    'Ottawa',
    'Sydney'
]

py_file = "./SelfTrain_test.py"
dir_path = os.path.abspath(py_file).strip(py_file)
for batchsize in [32]:
    for FS in [20, 40, 60, 80, 100]:
        for domain_id in [0, 1, 2, 3, 4]:
            with open(py_file) as fr:
                with open(f"./SelfTrain_{event_dics[domain_id]}_FS{FS}_BS{batchsize}.py", 'w') as fw:
                    codes = fr.read()
                    codes = codes.replace("domain_ID = 4", f"domain_ID = {domain_id}")
                    codes = codes.replace("few_shot_cnt = 100", f"few_shot_cnt = {FS}")
                    codes = codes.replace("1, 32, valid_idxs, loss_fn, evaluator = None)",
                                          f"1, {batchsize}, valid_idxs, loss_fn, evaluator = None)")
                    fw.write(codes)